<?php
class Userrule_Model_Userrule implements Userrule_Model_Mainable {
    
    private $rulemanager_data_getallrules;
    private $accountsettings_data_getallaccounts;
    private $userrurle_data_getuserrules;
    private $core_controller_csrftoken;
    private $userrule_model_pagedecision;
    
    public function main(array $variables = null) {
        if(isset($variables['get']['page'])){
            $this->userrule_model_pagedecision = new Userrule_Model_Pagedecision;
            return $this->userrule_model_pagedecision->main($variables);
        }
        else {
            $this->rulemanager_data_getallrules = new Rulemanager_Data_Getallrules;
            $this->accountsettings_data_getallaccounts = new Accountsettings_Data_Getaccountinfo;
            $this->userrurle_data_getuserrules = new Userrule_Data_Getuserrules;
            $this->core_controller_csrftoken = new Core_Controller_Csrftoken;
            $page['csrf_token'] = $this->core_controller_csrftoken->main($variables);
            $page['rule'] = $this->rulemanager_data_getallrules->main($variables);
            $page['account'] = $this->accountsettings_data_getallaccounts->main($page);
            $page['user_rule'] = $this->userrurle_data_getuserrules->main($page);
            $page['template'] = WEB_ROOT_FOLDER."userrule/views/userrule.php";
            return $page;
        }
    }

}
